#%RAML 1.0

title: Tenant API
baseUri: http://localhost:8081/{version}
version: v1

traits:
  validate: !include ../traits/validation.raml
types:
  tenantAttributes: !include ../schemas/moduleInfo.schema
  errors: !include ../schemas/errors.schema

/_/tenant:
  post:
    description: Provision a new / update an existing tenant
    is: [validate]
    body:
      application/json:
        type: tenantAttributes
        example:
          strict: false
          value: !include ../examples/moduleInfo.sample
    responses:
      200:
        description: "tenant id upgraded successfully, returns a list of commands that have failed while initializing the tenant"
        body:
          application/json:
      201:
        description: "tenant id added successfully, returns a list of commands that have failed while initializing the tenant"
        body:
          application/json:
      204:
        description: "tenant id exists, nothing will be added"
      400:
        description: "Bad request"
        body:
          text/plain:
      500:
        description: "Internal server error"
        body:
          text/plain:
            example: "Internal server error, contact administrator"
  get:
    description: Does tenant id already exist
    responses:
      200:
        description: "true or false indicator"
        body:
          text/plain:
            example: "Text....."
      500:
        description: "Internal server error"
        body:
          text/plain:
            example: "Internal server error, contact administrator"
  delete:
    description: drop tenant id
    responses:
      204:
        description: "Delete succeeded"
      400:
        description: "Bad request"
        body:
          text/plain:
      500:
        description: "Internal server error"
        body:
          text/plain:
            example: "Internal server error, contact administrator"
